package com.shuigu.ai.factory;

import com.shuigu.ai.assistant.AppNameGenService;
import com.shuigu.common.utils.spring.SpringUtils;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 生成应用名称
 */
@Configuration
@Slf4j
public class AppNameGenFactory {

    /**
     * 使用多例 Bean
     * @return
     */
    public AppNameGenService createAppNameGenService() {
        ChatModel chatModel = SpringUtils.getBean("routingChatModelPrototype");
        return AiServices.builder(AppNameGenService.class)
                .chatModel(chatModel)
                .build();
    }
}
